package com.party.core.model.member;

import com.party.core.model.BaseModel;
import org.springframework.beans.BeanUtils;

import java.util.Objects;

/**
 * 合伙人数据统计详情
 * Created by wei.li.
 *
 * @date 2018/1/16 0016
 * @time 10:25
 */
public class MemberCopartnerDetail extends BaseModel {
    private static final long serialVersionUID = 4484945623037642969L;
    // 会员编号
    private String memberId;
    // 总统计编号
    private String countId;
    // 报名数
    private Integer applyNum;
    // 订单数
    private Integer orderNum;
    // 众筹成功
    private Integer successNum;
    // 累计资金
    private Double totalMoney;
    // 累计佣金（包含下级）
    private Double totalBrokerage;
    // 我的佣金（不包含下级）
    private Double myBrokerage;
    // 操作 add/sub
    private String option;
    // 未结算佣金
    private Double notBalance;
    // 可提现佣金
    private Double canWithdrawal;

    //合伙人
    private Integer lowerNum;
    //自己获得的佣金
    private Float myCommission;

    public MemberCopartnerDetail() {
    }

    public MemberCopartnerDetail(Integer applyNum, Integer orderNum, Integer successNum,
                                 Double totalMoney, Double totalBrokerage, Double myBrokerage,
                                 Double notBalance, Double canWithdrawal,
                                 String option) {
        this.applyNum = applyNum;
        this.orderNum = orderNum;
        this.successNum = successNum;
        this.totalMoney = totalMoney;
        this.totalBrokerage = totalBrokerage;
        this.myBrokerage = myBrokerage;
        this.option = option;
        this.notBalance = notBalance;
        this.canWithdrawal = canWithdrawal;
    }

    public String getMemberId() {
        return memberId;
    }

    public void setMemberId(String memberId) {
        this.memberId = memberId;
    }

    public String getCountId() {
        return countId;
    }

    public void setCountId(String countId) {
        this.countId = countId;
    }

    public Integer getApplyNum() {
        return applyNum;
    }

    public void setApplyNum(Integer applyNum) {
        this.applyNum = applyNum;
    }

    public Integer getOrderNum() {
        return null == orderNum ? 0 : orderNum;
    }

    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }

    public Integer getSuccessNum() {
        return successNum;
    }

    public void setSuccessNum(Integer successNum) {
        this.successNum = successNum;
    }

    public Double getTotalMoney() {
        return null == totalMoney ? 0d : totalMoney;
    }

    public void setTotalMoney(Double totalMoney) {
        this.totalMoney = totalMoney;
    }

    public Double getTotalBrokerage() {
        return totalBrokerage;
    }

    public void setTotalBrokerage(Double totalBrokerage) {
        this.totalBrokerage = totalBrokerage;
    }

    public Integer getLowerNum() {
        return lowerNum;
    }

    public void setLowerNum(Integer lowerNum) {
        this.lowerNum = lowerNum;
    }

    public Float getMyCommission() {
        return myCommission;
    }

    public void setMyCommission(Float myCommission) {
        this.myCommission = myCommission;
    }

    public Double getMyBrokerage() {
        return myBrokerage;
    }

    public void setMyBrokerage(Double myBrokerage) {
        this.myBrokerage = myBrokerage;
    }

    public String getOption() {
        return option;
    }

    public void setOption(String option) {
        this.option = option;
    }

    public Double getNotBalance() {
        return notBalance;
    }

    public void setNotBalance(Double notBalance) {
        this.notBalance = notBalance;
    }

    public Double getCanWithdrawal() {
        return canWithdrawal;
    }

    public void setCanWithdrawal(Double canWithdrawal) {
        this.canWithdrawal = canWithdrawal;
    }

    public static MemberCopartnerDetail transform(CopartnerAnalyze copartnerAnalyze) {
        MemberCopartnerDetail memberCopartnerDetail = new MemberCopartnerDetail();
        BeanUtils.copyProperties(copartnerAnalyze, memberCopartnerDetail);
        return memberCopartnerDetail;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof MemberCopartnerDetail)) return false;
        if (!super.equals(o)) return false;
        MemberCopartnerDetail that = (MemberCopartnerDetail) o;
        return Objects.equals(getMemberId(), that.getMemberId()) &&
                Objects.equals(getCountId(), that.getCountId()) &&
                Objects.equals(getApplyNum(), that.getApplyNum()) &&
                Objects.equals(getOrderNum(), that.getOrderNum()) &&
                Objects.equals(getSuccessNum(), that.getSuccessNum()) &&
                Objects.equals(getTotalMoney(), that.getTotalMoney()) &&
                Objects.equals(getTotalBrokerage(), that.getTotalBrokerage()) &&
                Objects.equals(getMyBrokerage(), that.getMyBrokerage()) &&
                Objects.equals(getOption(), that.getOption()) &&
                Objects.equals(getLowerNum(), that.getLowerNum()) &&
                Objects.equals(getMyCommission(), that.getMyCommission()) &&
                Objects.equals(getNotBalance(), that.getNotBalance()) &&
                Objects.equals(getCanWithdrawal(), that.getCanWithdrawal());
    }

    @Override
    public int hashCode() {

        return Objects.hash(super.hashCode(), getMemberId(), getCountId(), getApplyNum(), getOrderNum(), getSuccessNum(), getTotalMoney(), getTotalBrokerage(), getMyBrokerage(), getOption(), getLowerNum(), getMyCommission(), getNotBalance(), getCanWithdrawal());
    }

    @Override
    public String toString() {
        return "MemberCopartnerDetail{" +
                "memberId='" + memberId + '\'' +
                ", countId='" + countId + '\'' +
                ", applyNum=" + applyNum +
                ", orderNum=" + orderNum +
                ", successNum=" + successNum +
                ", totalMoney=" + totalMoney +
                ", totalBrokerage=" + totalBrokerage +
                ", myBrokerage=" + myBrokerage +
                ", option='" + option + '\'' +
                ", lowerNum=" + lowerNum +
                ", myCommission=" + myCommission +
                ", notBalance=" + notBalance +
                ", canWithdrawal=" + canWithdrawal +
                '}';
    }
}
